#ifndef CUTEMAP_H
#define CUTEMAP_H

#include <QGraphicsGeoMap>
#include <QGeoMapCircleObject>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsSceneWheelEvent>
#include <QGeoMapPolylineObject>

#include <QPropertyAnimation>
#include <QParallelAnimationGroup>
#include <QGeoCoordinate>

QTM_USE_NAMESPACE

class CuteMap : public QGraphicsGeoMap
{
    Q_OBJECT
    Q_PROPERTY(double centerLatitude READ centerLatitude WRITE setCenterLatitude)
    Q_PROPERTY(double centerLongitude READ centerLongitude WRITE setCenterLongitude)

public:
    explicit CuteMap(QGeoMappingManager *manager, QGraphicsItem *parent = 0);

    void setCenter(const QGeoCoordinate & center);
    void animatedCenterTo(const QGeoCoordinate & center);

    double centerLatitude() const { return this->center().latitude(); }
    void setCenterLatitude(double lat) { QGeoCoordinate coord = this->center(); coord.setLatitude(lat); setCenter(coord); }
    double centerLongitude() const { return this->center().longitude(); }
    void setCenterLongitude(double lon) {  QGeoCoordinate coord = this->center(); coord.setLongitude(lon); setCenter(coord); }

signals:

public slots:

protected:
    QGeoMapCircleObject* me;
    bool panActive;
    bool firstTime;
    QList<QGeoCoordinate> m_previousPoints;
    QGeoMapPolylineObject* m_route;

     void mousePressEvent(QGraphicsSceneMouseEvent *event);
     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
     void wheelEvent(QGraphicsSceneWheelEvent *event);
};

#endif // CUTEMAP_H
